package de.pass.ch.datastr;

import static de.pass.ch.util.Constants.SPECIAL_NODEID;
import static java.lang.Integer.MAX_VALUE;

public class PQueueNodeElimination {

	// Level of the node. This is initially Integer.MAX_VALUE and will be set
	// to the calculated level directly after the contraction
	// of the node.
	public int level;

	// Size of the search spaces of the local searches. used
	// as priority term to speedup the contraction.
	public int searchSpace;

	// deleted/contracted neighbors counter
	public int deletedNeighbors;

	// Upper bound on search paths found by the query algorithm.
	// Datatype double is used since this bound is modified for
	// time-dependend routing (parameter "-T")
	public double searchPathHopBorder;

	// Those three variables are used for the priority term
	// Voronoi regions. They allow to manage the Voronoi regions
	// of the remaining nodes.
	// The voronoi region that this node belongs to.
	public int voronoiOwner;

	// The nodes in a voronoi region are stored in a linked list.
	// The list is terminated by SPECIAL_NODEID.
	public int voronoiNextBorderNode;

	// Contains the number of nodes in the voronoi region if the nodes
	// is not contracted. Otherwise, if the node is already contracted,
	// it contains the distance to the voronoiOwner.
	public int voronoiNumber;

	public PQueueNodeElimination() {
		level = MAX_VALUE;
		searchSpace = 0;
		deletedNeighbors = 0;
		searchPathHopBorder = 0;
		voronoiOwner = SPECIAL_NODEID;
		voronoiNextBorderNode = SPECIAL_NODEID;
		voronoiNumber = 0;
	}

	public PQueueNodeElimination(int level, int searchSpace,
			int deletedNeighbors, double searchPathHopBorder, int voronoiOwner,
			int voronoiNextBorderNode, int voronoiNumber) {
		this.level = level;
		this.searchSpace = searchSpace;
		this.deletedNeighbors = deletedNeighbors;
		this.searchPathHopBorder = searchPathHopBorder;
		this.voronoiOwner = voronoiOwner;
		this.voronoiNextBorderNode = voronoiNextBorderNode;
		this.voronoiNumber = voronoiNumber;
	}

	/** Wheter the node is eliminated, see unsigned int level. */
	public boolean isEliminated() {
		return level != MAX_VALUE;
	}

}
